package com.book.service.Impl;

import com.book.dao.Impl.userDaoImpl;
import com.book.dao.userDao;
import com.book.pojo.User;
import com.book.service.userService;

public class userServiceImpl implements userService {
    userDao userDao=new userDaoImpl();

    @Override
    public boolean addUser(User user) {
        int i = userDao.insertUser(user);
        if(i==-1){
            return false;
        }
        return true;
    }

    @Override
    public boolean existUsername(String username) {
        User user = userDao.queryByName(username);
        if(user==null){
            return false;
        }
        return true;
    }

    @Override
    public User login(User user) {
        return userDao.queryByNamePwd(user.getUsername(), user.getPassword());
    }
}
